package org.groupg.filetodb.model.database;

import com.google.common.base.MoreObjects;
import com.google.common.base.Objects;

/**
 * 表示存储过程元数据
 */
public class Procedure {
    /**
     * 过程目录
     */
    private String procedureCat;
    /**
     * 过程模式
     */
    private String procedureSchem;
    /**
     * 过程名称
     */
    private String procedureName;
    /**
     * 保留字段（未使用）
     */
    private String reserved1;
    /**
     * 保留字段（未使用）
     */
    private String reserved2;
    /**
     * 保留字段（未使用）
     */
    private String reserved3;
    /**
     * 过程注释
     */
    private String remarks;
    /**
     * 过程类型（DatabaseMetaData.procedureXXX常量）
     */
    private short procedureType;
    /**
     * 特定名称（唯一标识）
     */
    private String specificName;

    @Override
    public String toString() {
        return MoreObjects.toStringHelper(this)
                .add("procedureCat", procedureCat)
                .add("procedureSchem", procedureSchem)
                .add("procedureName", procedureName)
                .add("reserved1", reserved1)
                .add("reserved2", reserved2)
                .add("reserved3", reserved3)
                .add("remarks", remarks)
                .add("procedureType", procedureType)
                .add("specificName", specificName)
                .toString();
    }

    @Override
    public boolean equals(Object o) {
        if (o == null || getClass() != o.getClass()) return false;
        Procedure procedure = (Procedure) o;
        return getProcedureType() == procedure.getProcedureType() && Objects.equal(getProcedureCat(), procedure.getProcedureCat()) && Objects.equal(getProcedureSchem(), procedure.getProcedureSchem()) && Objects.equal(getProcedureName(), procedure.getProcedureName()) && Objects.equal(getReserved1(), procedure.getReserved1()) && Objects.equal(getReserved2(), procedure.getReserved2()) && Objects.equal(getReserved3(), procedure.getReserved3()) && Objects.equal(getRemarks(), procedure.getRemarks()) && Objects.equal(getSpecificName(), procedure.getSpecificName());
    }

    @Override
    public int hashCode() {
        return Objects.hashCode(getProcedureCat(), getProcedureSchem(), getProcedureName(), getReserved1(), getReserved2(), getReserved3(), getRemarks(), getProcedureType(), getSpecificName());
    }

    public String getProcedureCat() {
        return procedureCat;
    }

    public void setProcedureCat(String procedureCat) {
        this.procedureCat = procedureCat;
    }

    public String getProcedureSchem() {
        return procedureSchem;
    }

    public void setProcedureSchem(String procedureSchem) {
        this.procedureSchem = procedureSchem;
    }

    public String getProcedureName() {
        return procedureName;
    }

    public void setProcedureName(String procedureName) {
        this.procedureName = procedureName;
    }

    public String getReserved1() {
        return reserved1;
    }

    public void setReserved1(String reserved1) {
        this.reserved1 = reserved1;
    }

    public String getReserved2() {
        return reserved2;
    }

    public void setReserved2(String reserved2) {
        this.reserved2 = reserved2;
    }

    public String getReserved3() {
        return reserved3;
    }

    public void setReserved3(String reserved3) {
        this.reserved3 = reserved3;
    }

    public String getRemarks() {
        return remarks;
    }

    public void setRemarks(String remarks) {
        this.remarks = remarks;
    }

    public short getProcedureType() {
        return procedureType;
    }

    public void setProcedureType(short procedureType) {
        this.procedureType = procedureType;
    }

    public String getSpecificName() {
        return specificName;
    }

    public void setSpecificName(String specificName) {
        this.specificName = specificName;
    }
}
